Skip to content

⚡ Bolt: CSS 콘텐츠 및 해시 연산을 최상위 프로퍼티로 추출하여 디렉토리 렌더링 성능 최적화 - #272

Closed
seonghobae wants to merge 1 commit into
masterfrom
bolt-optimize-css-hashing-6561448932755046198
Closed

⚡ Bolt: CSS 콘텐츠 및 해시 연산을 최상위 프로퍼티로 추출하여 디렉토리 렌더링 성능 최적화#272
seonghobae wants to merge 1 commit into
masterfrom
bolt-optimize-css-hashing-6561448932755046198

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

💡 What: src/main/kotlin/html4tree/main.kt에서 재귀적으로 호출되는 process_dir 내에 있던 정적 CSS 문자열(cssContent, css)과 비용이 많이 드는 SHA-256 암호화 해시 계산(styleHash)을 파일 최상위(top-level) 프로퍼티로 이동했습니다.
🎯 Why: 디렉토리를 렌더링할 때마다 불필요하게 동일한 문자열 객체가 생성되고 무거운 암호화 해시가 반복 계산되어 가비지 컬렉션(GC) 압력과 성능 병목이 발생했습니다.
📊 Impact: 디렉토리 개수(N)만큼 반복되던 O(N) 연산과 메모리 할당을 애플리케이션 시작 시 1회만 계산되는 O(1)로 줄여 CPU 및 메모리 사용량을 대폭 최적화했습니다.
🔬 Measurement: JaCoCo 명령어 커버리지 100%를 성공적으로 유지하며 (testTopLevelCssProperties 테스트 추가), 기존의 테스트 스위트를 모두 통과하는 것을 확인했습니다.


PR created automatically by Jules for task 6561448932755046198 started by @seonghobae

Copilot AI review requested due to automatic review settings July 25, 2026 21:14
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves per-directory CSS string construction and SHA-256 CSP style hash computation out of process_dir into top-level properties to avoid repeated work during directory rendering in the Kotlin CLI.

Changes:

  • Extracted cssContent, styleHash, and css to file top-level properties in main.kt.
  • Added a unit test intended to keep coverage at 100% for the new top-level properties.
  • Documented the performance learning in .jules/bolt.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/main/kotlin/html4tree/main.kt Hoists static CSS + SHA-256 hash computation to top-level properties used by process_dir and CSP generation.
src/test/kotlin/html4tree/MainTest.kt Adds a test touching the new top-level CSS/hash properties for coverage/verification.
.jules/bolt.md Adds a Bolt learning note describing the rationale for hoisting the hash/string work.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

val exclude: Set<String> = excludeSet ?: process_ignore_file(curr_dir)

val cssContent = """
val cssContent = """
Comment on lines +309 to 313
val styleHash = "sha256-" + Base64.getEncoder().encodeToString(MessageDigest.getInstance("SHA-256").digest(cssContent.toByteArray(Charsets.UTF_8)))

val css = """
val css = """
<style>
${cssContent} </style>
Comment on lines +708 to +714

@Test
fun testTopLevelCssProperties() {
assertTrue(cssContent.isNotEmpty())
assertTrue(styleHash.startsWith("sha256-"))
assertTrue(css.contains("body {"))
}

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by canonical #363. The same static stylesheet and SHA-256 work is moved out of process_dir there, together with exact emitted-byte CSP correctness, an independent real generated-file digest regression, APA 7 doctoring, changelog, and fresh current-head CI/JaCoCo/Security/Semgrep evidence. No review or check from this duplicate head is reused.

@seonghobae seonghobae closed this Aug 5, 2026
@google-labs-jules

Copy link
Copy Markdown

Closing as superseded by canonical #363. The same static stylesheet and SHA-256 work is moved out of process_dir there, together with exact emitted-byte CSP correctness, an independent real generated-file digest regression, APA 7 doctoring, changelog, and fresh current-head CI/JaCoCo/Security/Semgrep evidence. No review or check from this duplicate head is reused.

Understood. Acknowledging that this work is now superseded by #363 and stopping work on this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants